package com.tanhua.model.vo;

import com.tanhua.model.mongo.RecommendUser;
import com.tanhua.model.pojo.Sound;
import com.tanhua.model.pojo.SoundTimes;
import com.tanhua.model.pojo.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class SoundVo implements Serializable {
    private Long id; //用户id
    private String nickname; //昵称
    private String avatar; //用户头像
    private String gender; //性别
    private Integer age; //年龄
    private String soundUrl;//语音地址
    private Integer remainingTimes;//剩余次数

    public static SoundVo init(UserInfo userInfo, Sound sound, SoundTimes soundTimes) {
        SoundVo vo = new SoundVo();
        vo.setId(userInfo.getId());
        vo.setNickname(userInfo.getNickname());
        vo.setAvatar(userInfo.getAvatar());
        vo.setGender(userInfo.getGender());
        vo.setAge(userInfo.getAge());
        vo.setSoundUrl(sound.getSoundUrl());
        vo.setRemainingTimes(soundTimes.getReceivetimes());
        return vo;
    }
}
